﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace ВУИ
{
    public partial class DiagOt : Form
    {
        Form1 Main;
        int Id;
        public DiagOt(Form1 main, int id)
        {
            InitializeComponent();
            Main = main;
            Id = id;

            List<ReportParameter> paramList = new List<ReportParameter>();
            paramList.Add(new ReportParameter("ФИО", Main.lPatient[Main.itnPatietn(id)].This.Surname + " " + Main.lPatient[Main.itnPatietn(id)].This.Name + " " + Main.lPatient[Main.itnPatietn(id)].This.Patronymic));
            paramList.Add(new ReportParameter("МКБ", Main.lPatient[Main.itnPatietn(id)].Diagnoz.mkb));
            paramList.Add(new ReportParameter("ДругоеЕтиолог", Main.lPatient[Main.itnPatietn(id)].Diagnoz.alterEtiolog));
             string s = "";
            foreach (int i in Main.lPatient[Main.itnPatietn(id)].Diagnoz.organ)
                s += " " + main.lOrgan[i].name + ",";
            if (Main.lPatient[Main.itnPatietn(id)].Diagnoz.alterOrgan != "") s += " " + Main.lPatient[Main.itnPatietn(id)].Diagnoz.alterOrgan;
            s.TrimEnd(',');
           
            paramList.Add(new ReportParameter("Органы", s));
            reportViewer1.LocalReport.SetParameters(paramList);
            List<ReportEdpidemcs> r = new List<ReportEdpidemcs>();

            foreach (etiologAtt e in main.lEtiAtt)
            {
                ReportEdpidemcs r1 = new ReportEdpidemcs();
                r1.Этиолог_диагноз_признак = e.name;
                r1.Номер = 1;
                if (main.lPatient[main.itnPatietn(id)].Diagnoz.etiolog.IndexOf(e.id) >= 0)
                {
                    r1.Да = "+";
                    r1.Нет = "";

                }
                else
                {
                    r1.Да = "";
                    r1.Нет = "+";
                }
                r.Add(r1);
           
            }
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("D", r));


            
        }

        private void DiagOt_Load(object sender, EventArgs e)
        {

            this.reportViewer1.RefreshReport();
        }

        private void reportViewer1_Load(object sender, EventArgs e)
        {

        }
    }
}
